<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/static/component/pear/css/pear.css"/>
</head>
<body>
<form class="layui-row layui-col-space10 layui-form">
    <div class="layui-col-md12">
        <div class="layui-card">
            <div class="layui-card-header">问候语设置</div>
            <div class="layui-form-item" style="margin-top: 20px">
                <label class="layui-form-label">内容</label>
                <div class="layui-input-block">
                    <textarea class="editormd-markdown-textarea" name="content" id="a_editormd" style="height: 260px;width: 80%">{$sentence.content}</textarea>
                </div>
            </div>
            {if $login['level'] == 'super_manager'}
            <div class="layui-form-item" style="margin-top: 20px">
                <label class="layui-form-label">默认语言</label>
                <div class="layui-input-inline">
                    <select name="lang">
                        <option value="">请选择默认语言</option>
                        <option value="cn" {if $business.lang == 'cn'}selected{/if}>中文简体</option>
                        <option value="tc" {if $business.lang == 'tc'}selected{/if}>中文繁体</option>
                        <option value="en" {if $business.lang == 'en'}selected{/if}>英文</option>
                        <option value="vi" {if $business.lang == 'vi'}selected{/if}>越南语</option>
                        <option value="th" {if $business.lang == 'th'}selected{/if}>泰语</option>
                        <option value="rus" {if $business.lang == 'rus'}selected{/if}>俄语</option>
                        <option value="id" {if $business.lang == 'id'}selected{/if}>印尼语</option>
                    </select>
                </div>
            </div>
            {/if}
            <div class="layui-input-block" style="min-height: 80px;">
                <button type="submit" class="pear-btn pear-btn-primary" lay-submit="" lay-filter="save">保存</button>
                <button type="reset" class="pear-btn">重置</button>
            </div>
        </div>
    </div>
</form>
<script src="/static/component/layui/layui.js"></script>
<script src="/static/component/pear/pear.js"></script>
<script type="text/javascript" src="__assets__/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__assets__/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
    var editorOption = {
        UEDITOR_HOME_URL: "__assets__/ueditor/",
        UEDITOR_ROOT_URL: "__assets__/ueditor/",
        serverUrl: "{:url('/service/upload/ueditor',['action'=>'config','service_id'=>$_SESSION['Msg']['service_id'],'admin_id'=>0])}",
        lang: "zh-cn",
        toolbars: [["undo", "redo", "|", "bold", "italic", "underline", "fontborder", "strikethrough", "superscript", "subscript", "removeformat", "formatmatch", "autotypeset", "blockquote", "pasteplain", "|", "forecolor", "backcolor",  "selectall", "cleardoc", "|","lineheight", "|", "customstyle", "paragraph", "fontfamily", "fontsize", "|",  "link", "unlink","|", "simpleupload", "insertimage", "emotion"]],
        initialContent: "",
        pageBreakTag: "_ueditor_page_break_tag_",
        initialFrameWidth: "100%",
        initialFrameHeight: "260",
        initialStyle: "body{font-size:14px}",
        autoFloatEnabled: false,
        allowDivTransToP: true,
        autoHeightEnabled: false,
        charset: "utf-8",
    };
    var DomUe=UE.getEditor("a_editormd",editorOption)
</script>
<script>
    layui.use(['form', 'jquery'], function () {
        let form = layui.form;
        let $ = layui.jquery;

        form.on('submit(save)', function (data) {
            $.ajax({
                data: JSON.stringify(data.field),
                dataType: 'json',
                contentType: 'application/json',
                type: 'post',
                success: function (res) {
                    if (res.code === 1) {
                        layer.msg(res.msg, {
                            icon: 1
                        }, function() {
                            location.reload();
                        });
                    } else {
                        layer.msg(res.msg, {icon: 2, time: 1500})
                    }
                }
            });
            return false;
        });
    })
</script>
</body>
</html>